package com.groupbuying.currency.producer.controller;


import com.groupbuying.currency.producer.service.CurrencyOperService;
import com.groupbuying.currency.producer.utils.JSONUtils;
import com.groupbuying.currency.producer.utils.currencyOperUtils.ParamUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @auter miaozhenfei
 * @date 2019/7/25 17:33
 */
@Api("积分基础功能接口")
@RestController
@RequestMapping("/integral")
public class CurrencyOperController {

    @Autowired
    private CurrencyOperService currencyOperService;



    @ApiOperation(value = "根据订单号查询单条积分支付状态", notes = "根据订单号查询单条积分支付状态")
    @PostMapping("/queryPayStateByOrderNum")
    public String queryPayStateByOrderNum(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
        //requst获取json
        return currencyOperService.queryPayStateByOrderNum(mapParams);


    }


    @ApiOperation(value = "密码校验接口 ", notes = "密码校验")
    @PostMapping("/passWordCheck")
    public String passWordCheck(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> mapParams = ParamUtils.getParamMap(request);

        return JSONUtils.parseJSON(currencyOperService.passWordCheck(mapParams));


    }


    @ApiOperation(value = "积分支付", notes = "积分支付")
    @PostMapping("/subOrderCurrency")
    public String subOrderCurrency(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> mapParams = ParamUtils.getParamMap(request);

        return JSONUtils.parseJSON(currencyOperService.subOrderCurrency(mapParams));


    }


    @ApiOperation(value = "生成预支付信息", notes = "生成预支付信息")
    @PostMapping("/creatPrePayInfo")
    public String creatPrePayInfo(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> mapParams = ParamUtils.getParamMap(request);

        return JSONUtils.parseJSON(currencyOperService.creatPrePayInfo(mapParams));
    }


    /**
     * 积分支付退款
     * */
    @ApiOperation(value = "积分支付退款", notes = "积分支付退款")
    @PostMapping("/addOrderCurrency")
    public String addOrderCurrency(HttpServletRequest request, HttpServletResponse response) {
        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
        return JSONUtils.parseJSON(currencyOperService.addOrderCurrency(mapParams));
    }


    /**
     * 财务后台直接充值积分
     */
//    @ApiOperation(value = "积分支付退款", notes = "积分支付退款")
//    @PostMapping("/addOrderCurrency")
//    public String addOrderCurrency(HttpServletRequest request, HttpServletResponse response) {
//        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
//        return JSONUtils.parseJSON(currencyOperService.addOrderCurrency(mapParams));
//    }




//
//
//    /**
//     * 可根据时间段筛选
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @ApiOperation(value = "统计所有所有用户支付成功,失败、交易中的总金额", notes = "统计所有所有用户支付成功,失败、交易中的总金额")
//    @PostMapping("/queryAllCustomerBalance")
//    public String queryAllCustomerBalance(HttpServletRequest request, HttpServletResponse response) {
//        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
//
//        return balanceService.queryAllPayMoney(mapParams);
//
//    }
//
//    /**
//     * 可根据时间段筛选
//     *
//     * @param request
//     * @param response
//     * @return
//     */
//    @ApiOperation(value = "查询用户下所有余额支付状态，可根据时间段筛选", notes = "查询用户下所有余额支付状态，可根据时间段筛选")
//    @PostMapping("/queryAllBalanceResult")
//    public String queryAllBalanceResult(HttpServletRequest request, HttpServletResponse response) {
//        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
//
//        return balanceService.queryAllBalanceResult(mapParams);
//
//    }
//
//    @ApiOperation(value = "根据订单号查询单条余额支付状态", notes = "根据订单号查询单条余额支付状态")
//    @PostMapping("/queryBalanceResult")
//    public String queryBalanceResult(HttpServletRequest request, HttpServletResponse response) {
//        Map<String, Object> mapParams = ParamUtils.getParamMap(request);
//        //requst获取json
//        return balanceService.queryBalanceResult(mapParams);


    }



